/**
* @file median.h
* @author Yasutomo Kawanishi
* @date Last Change: 2011/Feb/24.
* */
#ifndef _BACKGROUND_SUBTRACTOR_MEDIAN_H_
#define _BACKGROUND_SUBTRACTOR_MEDIAN_H_
#include <cv.h>
#include <vector>
#include <BackgroundImageGenerator/median.h>
#include <BackgroundSubtractor/rgbthresh.h>
class BackgroundSubtractorMedian{
public:
	BackgroundSubtractorMedian(int capacity=30, const cv::Scalar& thresh=cv::Scalar(128,128,128));
	BackgroundSubtractorMedian(const BackgroundSubtractorMedian& other);
	~BackgroundSubtractorMedian();
	const BackgroundSubtractorMedian& operator=(const BackgroundSubtractorMedian& other);

	void update(const cv::Mat& src);
	void train(const std::vector<cv::Mat>& trainingset);
	void apply(const cv::Mat& src, cv::Mat& dst);


private:
	cv::Mat temp;
	BackgroundImageGeneratorMedian generator;
	BackgroundSubtractorRGBThresh subtractor;
};
#endif